#pragma once

#include <iostream>
#include <vector>
#include <unistd.h>

typedef void (*fun_t)();

void PrintLog()
{
    std::cout << "pid: "<< getpid() << "团长，你就是个基霸" << std::endl;
}

void InsertMySQL()
{
    std::cout << "pid: "<< getpid() << "团长，我徒弟呢！！" << std::endl;
}

void NetRequest()
{
    std::cout << "pid: "<< getpid() << "团长，我在沈阳大街等你！" << std::endl;
}

class Task
{
public:
    Task()
    {
        funcs.push_back(PrintLog);
        funcs.push_back(InsertMySQL);
        funcs.push_back(NetRequest);
    }

    void Execute(int command)
    {
        if(command >= 0 && command < funcs.size()) funcs[command]();
    }

protected:
    std::vector<fun_t> funcs;
};